package com.java.comprehensive.design.behavioral_model.command_pattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author 窦绍飞
 * @create 2023/2/16
 * 服務員類 调用者角色
 */
public class Waitor {
	// 持有命令对象
	private List<Command> commands = new ArrayList<>();

	public void setCommand(Command command) {
		commands.add(command);
	}

	// 执行方法
	public void orderUp() {
		System.out.println("接受新订单");
		for (Command command : commands) {
			command.execute();
		}
	}
}
